﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="RR403Response_v1", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR403ResponseV1))]
    public class RR403ResponseV1Serializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IRR403ResponseV1 clazz;
        
        public RR403ResponseV1Serializer(IRR403ResponseV1 clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("Isikukood");
            if (clazz.Isikukood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikukood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikukood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Eesnimi");
            if (clazz.Eesnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Eesnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Eesnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Perenimi");
            if (clazz.Perenimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Perenimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Perenimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Isikuolek");
            if (clazz.Isikuolek!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikuolek))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikuolek");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Veakood");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "integer");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInteger(((decimal)(clazz.Veakood))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("Veatekst");
            if (clazz.Veatekst!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Veatekst))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Veatekst");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Elukoht");
            if (clazz.Elukoht!=null) {
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute(">>>RR403Response_v1>Elukoht>Elukoht", "http://producers.rr.xtee.riik.ee/producer/rr", clazz.Elukoht.Count);
                for (int x = 0; ((clazz.Elukoht != null) 
                            && (x < clazz.Elukoht.Count)); x = (x + 1)) {
                    if (clazz.Elukoht[x]!=null) {
                        Writer.WriteStartElement("Elukoht");
                        global::Xtee.Core.SerializationMetadata metaElukoht = this.GetMetaData(clazz.Elukoht[x]);
                        Writer.WriteTypeAttribute(metaElukoht.TypeQualifiedName.Namespace, metaElukoht.TypeQualifiedName.Name);
                        metaElukoht.NewSerializer(clazz.Elukoht[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Elukoht");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Sama_aadressiga");
            if (clazz.SamaAadressiga!=null) {
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute(">>>RR403Response_v1>Sama_aadressiga>Sama_aadressiga", "http://producers.rr.xtee.riik.ee/producer/rr", clazz.SamaAadressiga.Count);
                for (int x = 0; ((clazz.SamaAadressiga != null) 
                            && (x < clazz.SamaAadressiga.Count)); x = (x + 1)) {
                    if (clazz.SamaAadressiga[x]!=null) {
                        Writer.WriteStartElement("Sama_aadressiga");
                        global::Xtee.Core.SerializationMetadata metaSamaAadressiga = this.GetMetaData(clazz.SamaAadressiga[x]);
                        Writer.WriteTypeAttribute(metaSamaAadressiga.TypeQualifiedName.Namespace, metaSamaAadressiga.TypeQualifiedName.Name);
                        metaSamaAadressiga.NewSerializer(clazz.SamaAadressiga[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SamaAadressiga");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="Isikukood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR403Response_v1>Isikukood");
                }
                clazz.Isikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Isikukood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR403Response_v1>Isikukood", Reader.LocalName);
            }
            if (Reader.LocalName=="Eesnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR403Response_v1>Eesnimi");
                }
                clazz.Eesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Eesnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR403Response_v1>Eesnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="Perenimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR403Response_v1>Perenimi");
                }
                clazz.Perenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Perenimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR403Response_v1>Perenimi", Reader.LocalName);
            }
            if (Reader.LocalName=="Isikuolek") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR403Response_v1>Isikuolek");
                }
                clazz.Isikuolek = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Isikuolek")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR403Response_v1>Isikuolek", Reader.LocalName);
            }
            if (Reader.LocalName=="Veakood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR403Response_v1>Veakood");
                }
                clazz.Veakood = new global::Xtee.Core.Schema.XsdInteger(Reader.ReadElementString("Veakood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR403Response_v1>Veakood", Reader.LocalName);
            }
            if (Reader.LocalName=="Veatekst") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR403Response_v1>Veatekst");
                }
                clazz.Veatekst = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Veatekst")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR403Response_v1>Veatekst", Reader.LocalName);
            }
            if (Reader.LocalName=="Elukoht") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR403Response_v1>Elukoht");
                }
                clazz.Elukoht = new System.Collections.Generic.List<RR403ResponseV1.IElukohtType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Elukoht");
                    for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                && (Reader.LocalName == "Elukoht")); ) {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RR403Response_v1>Elukoht>Elukoht");
                        }
                        global::Xtee.Core.SerializationMetadata metaElukoht = this.GetMetaData<RR403ResponseV1.IElukohtType>(Reader, ">>>RR403Response_v1>Elukoht>Elukoht", "http://producers.rr.xtee.riik.ee/producer/rr");
                        RR403ResponseV1.IElukohtType item = metaElukoht.NewEntity<RR403ResponseV1.IElukohtType>();
                        clazz.Elukoht.Add(item);
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Elukoht");
                            metaElukoht.NewSerializer(item).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR403Response_v1>Elukoht", Reader.LocalName);
            }
            if (Reader.LocalName=="Sama_aadressiga") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR403Response_v1>Sama_aadressiga");
                }
                clazz.SamaAadressiga = new System.Collections.Generic.List<RR403ResponseV1.ISamaAadressigaType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Sama_aadressiga");
                    for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                && (Reader.LocalName == "Sama_aadressiga")); ) {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RR403Response_v1>Sama_aadressiga>Sama_aadressiga");
                        }
                        global::Xtee.Core.SerializationMetadata metaSamaAadressiga = this.GetMetaData<RR403ResponseV1.ISamaAadressigaType>(Reader, ">>>RR403Response_v1>Sama_aadressiga>Sama_aadressiga", "http://producers.rr.xtee.riik.ee/producer/rr");
                        RR403ResponseV1.ISamaAadressigaType item = metaSamaAadressiga.NewEntity<RR403ResponseV1.ISamaAadressigaType>();
                        clazz.SamaAadressiga.Add(item);
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Sama_aadressiga");
                            metaSamaAadressiga.NewSerializer(item).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR403Response_v1>Sama_aadressiga", Reader.LocalName);
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RR403Response_v1>Elukoht>Elukoht", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR403ResponseV1.ElukohtType))]
        public class ElukohtTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RR403ResponseV1.IElukohtType clazz;
            
            public ElukohtTypeSerializer(RR403ResponseV1.IElukohtType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("Elukoht.Riik");
                if (clazz.ElukohtRiik!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtRiik))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtRiik");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Maakondkd");
                if (clazz.ElukohtMaakondkd!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtMaakondkd))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtMaakondkd");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Maakond");
                if (clazz.ElukohtMaakond!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtMaakond))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtMaakond");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Vald");
                if (clazz.ElukohtVald!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtVald))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtVald");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Asula");
                if (clazz.ElukohtAsula!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtAsula))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtAsula");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Vkoht");
                if (clazz.ElukohtVkoht!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtVkoht))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtVkoht");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Tanav");
                if (clazz.ElukohtTanav!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtTanav))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtTanav");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Nimi");
                if (clazz.ElukohtNimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtNimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtNimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Maja");
                if (clazz.ElukohtMaja!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtMaja))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtMaja");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Korter");
                if (clazz.ElukohtKorter!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtKorter))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtKorter");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Sihtnumber");
                if (clazz.ElukohtSihtnumber!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtSihtnumber))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtSihtnumber");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Alates");
                if (clazz.ElukohtAlates!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtAlates))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtAlates");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Elukoht.Kuni");
                if (clazz.ElukohtKuni!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ElukohtKuni))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ElukohtKuni");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="Elukoht.Riik") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Riik");
                    }
                    clazz.ElukohtRiik = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Riik")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Riik", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Maakondkd") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Maakondkd");
                    }
                    clazz.ElukohtMaakondkd = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Maakondkd")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Maakondkd", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Maakond") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Maakond");
                    }
                    clazz.ElukohtMaakond = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Maakond")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Maakond", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Vald") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Vald");
                    }
                    clazz.ElukohtVald = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Vald")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Vald", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Asula") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Asula");
                    }
                    clazz.ElukohtAsula = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Asula")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Asula", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Vkoht") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Vkoht");
                    }
                    clazz.ElukohtVkoht = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Vkoht")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Vkoht", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Tanav") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Tanav");
                    }
                    clazz.ElukohtTanav = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Tanav")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Tanav", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Nimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Nimi");
                    }
                    clazz.ElukohtNimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Nimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Nimi", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Maja") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Maja");
                    }
                    clazz.ElukohtMaja = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Maja")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Maja", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Korter") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Korter");
                    }
                    clazz.ElukohtKorter = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Korter")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Korter", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Sihtnumber") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Sihtnumber");
                    }
                    clazz.ElukohtSihtnumber = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Sihtnumber")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Sihtnumber", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Alates") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Alates");
                    }
                    clazz.ElukohtAlates = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Alates")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Alates", Reader.LocalName);
                }
                if (Reader.LocalName=="Elukoht.Kuni") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Kuni");
                    }
                    clazz.ElukohtKuni = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht.Kuni")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Elukoht>Elukoht>Elukoht.Kuni", Reader.LocalName);
                }
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RR403Response_v1>Sama_aadressiga>Sama_aadressiga", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR403ResponseV1.SamaAadressigaType))]
        public class SamaAadressigaTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RR403ResponseV1.ISamaAadressigaType clazz;
            
            public SamaAadressigaTypeSerializer(RR403ResponseV1.ISamaAadressigaType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("Sama_aadressiga.Isikukood");
                if (clazz.SamaAadressigaIsikukood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SamaAadressigaIsikukood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SamaAadressigaIsikukood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Sama_aadressiga.Eesnimi");
                if (clazz.SamaAadressigaEesnimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SamaAadressigaEesnimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SamaAadressigaEesnimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Sama_aadressiga.Perenimi");
                if (clazz.SamaAadressigaPerenimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SamaAadressigaPerenimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SamaAadressigaPerenimi");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="Sama_aadressiga.Isikukood") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Sama_aadressiga>Sama_aadressiga>Sama_aadressiga.Isikukood");
                    }
                    clazz.SamaAadressigaIsikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Sama_aadressiga.Isikukood")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Sama_aadressiga>Sama_aadressiga>Sama_aadressiga.Isikukood", Reader.LocalName);
                }
                if (Reader.LocalName=="Sama_aadressiga.Eesnimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Sama_aadressiga>Sama_aadressiga>Sama_aadressiga.Eesnimi");
                    }
                    clazz.SamaAadressigaEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Sama_aadressiga.Eesnimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Sama_aadressiga>Sama_aadressiga>Sama_aadressiga.Eesnimi", Reader.LocalName);
                }
                if (Reader.LocalName=="Sama_aadressiga.Perenimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR403Response_v1>Sama_aadressiga>Sama_aadressiga>Sama_aadressiga.Perenimi");
                    }
                    clazz.SamaAadressigaPerenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Sama_aadressiga.Perenimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR403Response_v1>Sama_aadressiga>Sama_aadressiga>Sama_aadressiga.Perenimi", Reader.LocalName);
                }
            }
        }
    }
}
